package com.atguigu.schedule.controller;

import com.atguigu.schedule.pojo.SysUser;
import com.atguigu.schedule.service.Impl.SysUserServiceImpl;
import com.atguigu.schedule.service.SysUserService;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/user/*")
public class SysUserController extends BaseController<SysUserController> {

    public void regist(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 接收客户端提交的参数
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        SysUser sysUser = new SysUser(0, username, password);
        // 调用service层方法,完成注册
        SysUserService userService = new SysUserServiceImpl();
        int code = userService.register(sysUser);
        // 根据注册结果, 做页面跳转
    }
}
